package cn.lizemin.flowable.common;

import lombok.Getter;

/**
 * @author lzm
 * @Date 2024/6/30
 * @description
 */
@Getter
public class RespBean {

    private Integer code;

    private String message;

    private Object data;

    private RespBean() {

    }

    private RespBean(Integer code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static RespBean success() {
        return new RespBean(200, "success", null);
    }

    public static RespBean success(Object data) {
        return new RespBean(200, "success", data);
    }

    public static RespBean fail() {
        return new RespBean(500, "fail", null);
    }

    public static RespBean fail(Exception ex) {
        return new RespBean(500, ex.getMessage(), null);
    }

    public RespBean message(String message) {
        this.message = message;
        return this;
    }


}
